FROM ubuntu:18.04

ADD sources.list /etc/apt/

RUN apt-get update -y && apt-get install -y software-properties-common curl

WORKDIR /usr/local/tools/
COPY *.tar.xz /usr/local/tools/

RUN tar xf node-v12.11.1-linux-x64.tar.xz \
  && mv /usr/local/tools/node-v12.11.1-linux-x64 /usr/local/tools/nodejs \
  && ln -s /usr/local/tools/nodejs/bin/npm   /usr/local/bin/ \
  && ln -s /usr/local/tools/nodejs/bin/node   /usr/local/bin/ \
  && rm /usr/local/tools/node-v12.11.1-linux-x64.tar.xz \
  && apt-get update -y && apt-get install -y libsasl2-dev python3 python3-pip openjdk-8-jdk-headless

RUN pip3 install \
  jupyterlab \
  ipywidgets \
  numpy \
  scipy \
  scikit-learn \
  matplotlib \
  ipython \
  pandas \
  pyhive \
  pyspark \
  thrift \
  sasl \
  six==1.15.0 \
  sql_magic \
  thrift_sasl -i https://mirrors.aliyun.com/pypi/simple/

COPY bin/entrypoint.sh /usr/local/bin/
COPY config/ /root/.jupyter/

EXPOSE 8888
VOLUME /notebooks
WORKDIR /notebooks
ENTRYPOINT ["entrypoint.sh"]
